package com.hoshiicloud.registered.feign;

import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.common.validate.annotations.Mobile;
import com.hoshiicloud.registered.feign.hystrix.HystrixVericenterFeignFallbackImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author MarkerCCC
 * @date 2019/9/10 - 17:00
 */
@FeignClient(name = "hoshiicloud-vericenter", fallback = HystrixVericenterFeignFallbackImpl.class)
public interface VericenterService {

    /**
     * 验证短信验证码
     *
     * @param msgId msgId 短信id
     * @param code  code 验证码
     * @return Response
     */
    @PostMapping("/sms/check")
    Response checkCode(@RequestParam("msgId") String msgId, @RequestParam("code") String code);

    /**
     * 发送短信验证码
     *
     * @param mobile    mobile 电话号码
     * @param code      code 验证码
     * @param expSecond expSecond 有效时间(单位:秒)
     * @return String 短信id
     */
    @PostMapping("/sms/sendCode")
    Response<String> sendCode(@RequestParam("mobile") String mobile, @RequestParam("code") String code,
            @RequestParam("expSecond") long expSecond);
}
